﻿using System;
using System.Collections.Generic;

using NewModel.Accounting.Calculation;
using NewModel.Accounting.Core;
using NewModel.Accounting.Persistence;

namespace NewModel.UnitTests.Accounting.Persistence._Samples_
{
    public static class Sample
    {
        public static Transaction ExpenseTransaction
        {
            get
            {
                return new Transaction(new DateTime(2000, 1, 1),
                    "comment", 2 * Currency.Usd, Account.Asset, Account.Expense);
            }
        }

        public static Interval Interval
        {
            get { return new Interval(new DateTime(2003, 1, 1), new DateTime(2005, 1, 1)); }
        }

        public static Ledger Ledger
        {
            get
            {
                return new Ledger
                {
                    Accounts = new List<Account>
                            {
                                Account.Root, 
                                Account.Asset, 
                                Account.Cache,
                                Account.Equity,
                                Account.Exchange,
                                Account.Expense,
                            },
                    Currencies = new List<Currency>
                            {
                                Currency.Byr,
                                Currency.Eur,
                                Currency.Rur,
                                Currency.Usd
                            },
                    Batches = new List<BatchDescriptor>
                        {
                            new BatchDescriptor
                            {
                                ReferenceInterval = new Interval(
                                    new DateTime(2000, 1, 1), 
                                    new DateTime(2001, 12, 31)),
                            }
                        }
                };
            }
        }
        public static Batch Batch
        {
            get
            {
                return new Batch
                {
                    IngressBalance = new List<AccountTotal>
                    {
                        new AccountTotal
                        {
                            Account = Account.Asset,
                            Total = new Total
                            {
                                Credit = new MoneyBag(63*Currency.Usd),
                                Debit = new MoneyBag(67*Currency.Usd),
                            }
                        }
                    },
                    ReferenceInterval = new Interval(new DateTime(2000, 1, 1), new DateTime(2000, 12, 31)),
                    Transactions = new List<Transaction> { ExpenseTransaction },
                    ExchangeRates = new List<ExchangeRate>
                    {
                        new ExchangeRate(new DateTime(2000, 1, 1), 
                            Currency.Byr, Currency.Usd, 9500, 1, 
                            ExchangeRateSources.Nbrb)
                    }
                };
            }
        }
    }
}